#include<iostream>
#include<cmath>
using namespace std;

int main()              //救治群众，计算时间
{
    int n;
    cin >> n;
    double xy[n][2] = {};
    int nums[n] = {};
    double lens = 0;
    double time0 = 0;
    int people = 0;
    for(int i = 0;i<n;i++)
    {
        cin >> xy[i][0] >> xy[i][1] >> nums[i];
        lens = sqrt(xy[i][0]*xy[i][0]+xy[i][1]*xy[i][1])+lens;
        people = people +nums[i];
    }
    lens = 2*lens;
    time0 = people*1+people*0.5+lens/50.0;
    int time1 =(int)time0+1;
    cout << time1 << endl;
    return 0;
}